#include <iostream>

//using declare mechanism
using std::cout;
using std::endl;

namespace why
{
int a = 100;

void func(){
    cout << "why inside" << endl;
}
}//end of namespace why

namespace dgg
{
int a = 10;

void func(){
    std::cout << "dgg inside" << std::endl;
}
}//end of namespace dgg

namespace A
{
namespace B
{
void func1()
{
    cout << "Hello inside A inside B" << endl;
}
}
}



void test(){
    //using compile cmd usually use in local scope
    //the effect will lapse when this function exit
    using namespace dgg;//using compile cmd

    /* using namespace why; */
    //both these namespace have same function
    //using two namespace in same time will be error
    //compiler cannot distinguish
    
    //same as using declare mechanism
    //using why::func();
    //using dgg::func();

    cout << a << endl;
    func();

    cout << why::a << endl;
    why::func();

    A::B::func1();
}


int main()
{
    test();
    return 0;
}

